﻿using UnityEngine;

public class PlayerMoveState: PlayerGroundState
{
    public PlayerMoveState(ControllerBase controller, StateMachineBase stateMachine, string stateName,string 
        animatorParameter) 
        : base(controller, stateMachine, stateName,animatorParameter)
    {
    }
    
    public override void Enter()
    {
        base.Enter();
    }

    public override void Update()
    {
        base.Update();
        if (SelfController.moveX==0)
        {
            stateMachine.ChangeState(Setting.idle);
            return;
        }
        Move();
        
    }
    
    private void Move()
    {
        controller.SetVelocity(new Vector2(SelfController.moveX * Setting.speed,
            controller.GetVelocity().y));
    }

    public override void Exit()
    {
        base.Exit();
    }
}